package com.yuanfengerp.supplierexpense.controller;


import com.yuanfengerp.publicUtil.Result;
import com.yuanfengerp.supplierexpense.model.SupplierExpenseInfo;
import com.yuanfengerp.supplierexpense.service.impl.SupplierExpenseServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class SupplierExpenseController {
    @Autowired
    private SupplierExpenseServiceImpl sesi;
    @GetMapping("/selectAllSupplierExpenseInfo")
    public Result<List<SupplierExpenseInfo>> selectAllSupplierExpenseInfo(){
        return sesi.selectAllSupplierExpenseInfo();
    }
    @PostMapping("/deleteSupplierExpenseInfo")
    public Result<String> deleteSupplierExpenseInfo(String supplier_expense_ID){
        return sesi.deleteSupplierExpenseInfo(supplier_expense_ID);
    }
    @PostMapping("/insertSupplierExpenseInfo")
    public Result<String> insertSupplierExpenseInfo(@RequestBody SupplierExpenseInfo supplierExpenseInfo){
        return sesi.insertSupplierExpenseInfo(supplierExpenseInfo);
    }
    @PostMapping("/updateSupplierExpenseInfo")
    public Result<String> updateSupplierExpenseInfo(@RequestBody SupplierExpenseInfo supplierExpenseInfo){
        return sesi.updateSupplierExpenseInfo(supplierExpenseInfo);
    }
    @PostMapping("/selectSupplierExpenseInfo")
    public Result<List<SupplierExpenseInfo>> selectSupplierExpenseInfo(@RequestBody Map<String, Object> params){
        System.out.println("Controller" + params.toString());
        return sesi.selectSupplierExpenseInfo(params);
    }
    @PostMapping("/selectSupplierExpenseInfoItems")
    public Result<List<SupplierExpenseInfo>> selectSupplierExpenseInfoItems(@Param("supplier_expense_ID") String supplier_expense_ID){
        return sesi.selectSupplierExpenseInfoItems(supplier_expense_ID);
    }
}
